<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>

<!-- 商品初始化分类      公共类 -->
<script type="text/javascript">
	$(function(){
		$.ajax({
			url : "${ctx}/goodsClass/queryByGoodsClassList.do",
			type : "post",
			//	dataType : 'json',
//			data : {"":""},
			async : false,
			success : function(data, status) {
			//	alert(JSON.stringify(data[0].children));
				var html = "";
				$.each(data, function(i,result){      //<!--<img src='${ctx}/images/more.png' alt=''/>-->
					html+="<li><a href='${ctx}/goodsClass/queryGoodsClassList?classId="+result.id+"&className="+result.name+"' target='_blank'>"+result.name+"</a><span>></span></li>"
				});
				$("#ulGoodsA").append(html);
				var html2 = "";
				//alert(JSON.stringify(data[0].children))
				$.each(data, function(i,result){      
					html2 += "<div class='item'>";
					$.each(data[i].children, function(i,goodsTwo){    
						html2 += "<div>"
							+"<p data-id='"+goodsTwo.id+"'>"+goodsTwo.name+"</p>";
							//	alert(JSON.stringify(goodsTwo.children))
								for(var i=0;i<goodsTwo.children.length;i++){
									html2+=" <a href='${ctx}/goodsClass/queryGoodsClassList?classId="+goodsTwo.children[i].id+"&className="+goodsTwo.children[i].name+"' target='_blank'>"+goodsTwo.children[i].name+"</a>";
								}
						html2 += "</div>";
					});
					  html2 += "</div>";
				});
				$("#itemsB").append(html2);
 			},
 			error : function(xhr, status, e) {
 				alert("失败错误信息"+e)
 			}
     	 });
     	 
     	 //全部商品
		$('.all_pro').hover(function(){
			$(this).find('ul').stop().slideToggle();
		});
		$('.all_pro ul li').hover(function(){
			$index = $(this).index();
			var $height = $("#ulGoodsA").height();
			$('.all_pro .item').css('min-height',$height);
			$('.all_pro .items .item').eq($index).css('display','block');
			$(this).find('img').attr('src','images/redmore.png');
		},function(){
			$index = $(this).index();
			$('.all_pro .items .item').eq($index).css('display','none');
			$(this).find('img').attr('src','images/more.png');
		});
		$('.all_pro .items .item').hover(function(){
			$index = $(this).index();
			$(this).css('display','block');
		},function(){
			$(this).css('display','none');
		});
	});

</script>
 <!--商品列表-->
<div class="l f14 three all_pro" id="goodsByList">
	<p class="all f18">全部商品</p>
	<ul id="ulGoodsA">
		<%-- <c:forEach var="goods" items="${GoodsClassList }">
			<li>${goods.name }<img src="images/more.png" alt=""  /></li>
		</c:forEach> --%>
	</ul>
	
	<div class="items" id="itemsB">
		<%-- <c:forEach var="goodsFirst" items="${GoodsClassList}">
			<div class="item">
					<c:forEach var="goodsTwo" items="${goodsFirst.children}">
				<div>
					<p>${goodsTwo.name}</p>
						<c:forEach var="goodsThree" items="${goodsTwo.children }">
							<a href="${ctx}/goodsClass/queryGoodsClassList?classId=${goodsThree.id}" >${goodsThree.name}</a>
						</c:forEach>
				</div>
				</c:forEach>
			</div>
		</c:forEach>  --%>
	</div> 
</div>
